package com.shengde.jinwawaforleader.model.myJob.adapter;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.shengde.jinwawaforleader.R;
import com.shengde.jinwawaforleader.network.protocolbean.ProChapterList;

import java.util.List;

/**
 * 使用介绍，适配器 宿主： 使用介绍：MyOrderActivity 启动项： 我的订单：
 * */
public class MingshiDetailAdapter extends BaseAdapter {
	protected Context context;
	public List<ProChapterList.CaselistEntity> list;

	public MingshiDetailAdapter(List<ProChapterList.CaselistEntity > mList, Context context) {
		this.list = mList;
		this.context = context;
	}
	@Override
	public int getCount() {
		return (list == null) ? 0 : list.size();
	}

	@Override
	public Object getItem(int position) {
		return (list == null) ? null : list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		if (list == null || list.size() <= 0) {
			return convertView;
		}
		ViewHolder holder = null;
		if (convertView == null) {
			holder = new ViewHolder();
			convertView = LayoutInflater.from(context).inflate(
					R.layout.item_fragment_mingshi_detail, parent, false);

			holder.num = (TextView)convertView.findViewById(R.id.num);
			holder.title = (TextView)convertView.findViewById(R.id.title);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		holder.num.setText(String.valueOf(position+1));
		holder.title.setText(list.get(position).getTitle());
		return convertView;
	}

	class ViewHolder {
		public TextView num,title;
	}
}
